package com.jsgt.greekfire.bean

import android.os.Parcel
import android.os.Parcelable

/**
 * author fhx
 * create time 2020/4/22 20:28
 **/
class MessageBean() : Parcelable {
    var title: String? = null
    var content: String? = null
    var createTime: String? = null

    constructor(parcel: Parcel) : this() {
        title = parcel.readString()
        content = parcel.readString()
        createTime = parcel.readString()
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeString(title)
        parcel.writeString(content)
        parcel.writeString(createTime)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<MessageBean> {
        override fun createFromParcel(parcel: Parcel): MessageBean {
            return MessageBean(parcel)
        }

        override fun newArray(size: Int): Array<MessageBean?> {
            return arrayOfNulls(size)
        }
    }

}

class MessagePage() : Parcelable {
    var totalCount: Int = 0
    var pageSize: Int = 0
    var totalPage: Int = 0
    var currPage: Int = 0
    var list: List<MessageBean>? = null

    constructor(parcel: Parcel) : this() {
        totalCount = parcel.readInt()
        pageSize = parcel.readInt()
        totalPage = parcel.readInt()
        currPage = parcel.readInt()
        list = parcel.createTypedArrayList(MessageBean)
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeInt(totalCount)
        parcel.writeInt(pageSize)
        parcel.writeInt(totalPage)
        parcel.writeInt(currPage)
        parcel.writeTypedList(list)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<MessagePage> {
        override fun createFromParcel(parcel: Parcel): MessagePage {
            return MessagePage(parcel)
        }

        override fun newArray(size: Int): Array<MessagePage?> {
            return arrayOfNulls(size)
        }
    }
}